'''
Created on 2011-5-31

@author: elm
'''

class DdbmsException(Exception):
    '''
    Base class for exceptions in ddbms project
    '''
    id = 0
    message = None
    type = None
    
    def __init__(self,id,type,message):
        '''
        Constructor
        '''
        self.id=id
        self.message=message
        self.type = type
    
    def __str__(self):
        return self.type + ": " + self.message

InvalidRA = DdbmsException(1,'InvalidRA',"Invalid relational algebra object")
TableNotFound = DdbmsException(2,'TableNotFound',"Could not find table")
ColumnNotFound = DdbmsException(3,'ColumnNotFound',"Could not find table column")
AmbiguousColumn = DdbmsException(4,'AmbiguousColumn',"Ambiguous table name omitting")
InvalidSchema = DdbmsException(5,'InvalidSchema',"Invalid database schema")
InvalidSegmentation = DdbmsException(6,'InvalidSegmentation',"Invalid type for database segmentation")
InvalidCondition = DdbmsException(7,'InvalidCondition',"Invalid logical expression object")
InvalidOp = DdbmsException(8,'InvalidOp','Invalid Operator')